<!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->
<!-- 修改 by bbs.hongyuvip.com 百度编辑器 begin -->

{include file="pageheader_bd.htm"} {insert_scripts files="../js/utils.js,selectzone_bd.js,colorselector.js"}
<!-- 修改 by bbs.hongyuvip.com 百度编辑器 end -->
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />
<!-- zTree Style -->
<link href="styles/zTree/zTreeStyle.css" rel="stylesheet" type="text/css" />
{insert_scripts files='jquery.ztree.all-3.5.min.js,category_selecter.js'} {if $warning}
<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">
	<li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;">{$warning}</li>
</ul>
{/if}

<!-- start goods form -->
<div class="tab-div">
	<!-- tab bar -->
	<div id="tabbar-div">
		<p>
			<span class="tab-front" id="general-tab">{$lang.tab_general}</span>
			<span class="tab-back" id="detail-tab">{$lang.tab_detail}</span>
			<span class="tab-back" id="mix-tab">{$lang.tab_mix}</span>
			{if $goods_type_list}
			<span class="tab-back" id="properties-tab">{$lang.tab_properties}</span>
			{/if}
			<span class="tab-back" id="gallery-tab">{$lang.tab_gallery}</span>
			<span class="tab-back" id="linkgoods-tab">{$lang.tab_linkgoods}</span>
			{if $code eq ''}
			<span class="tab-back" id="groupgoods-tab">{$lang.tab_groupgoods}</span>
			{/if}
			<span class="tab-back" id="article-tab">{$lang.tab_article}</span>
		</p>
	</div>

	<!-- tab body -->
	<div id="tabbody-div">
		<form enctype="multipart/form-data" action="" method="post" name="theForm">
			<!-- 鏈€澶ф枃浠堕檺鍒 -->
			<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
			<!-- 閫氱敤淇℃伅 -->
			<table width="100%" id="general-table" align="center">
				<tr>
					<td class="label">{$lang.lab_goods_name}</td>
					<td>
						<input type="text" name="goods_name" value="{$goods.goods_name|escape}" style="float:left;color:{$goods_name_color};" size="30" />
						<div style="background-color:{$goods_name_color};float:left;margin-left:2px;" id="font_color" onclick="ColorSelecter.Show(this);">
							<img src="images/color_selecter.gif" style="margin-top:-1px;" />
						</div>
						<input type="hidden" id="goods_name_color" name="goods_name_color" value="{$goods_name_color}" />
						&nbsp;
						<select name="goods_name_style">
							<option value="">{$lang.select_font}</option>

							{html_options options=$lang.font_styles selected=$goods_name_style}

						</select>
						{$lang.require_field}
					</td>
				</tr>
				<tr>
					<td class="label">
						<a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_goods_sn}
					</td>
					<td>
						<input type="text" name="goods_sn" value="{$goods.goods_sn|escape}" size="20" onblur="checkGoodsSn(this.value,'{$goods.goods_id}')" />
						<span id="goods_sn_notice"></span>
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">{$lang.notice_goods_sn}</span>
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_goods_cat}</td>
					<td>
						<input type="text" id="cat_name" name="cat_name" nowvalue="{$goods_cat_id}" value="{$goods_cat_name}">
						<input type="hidden" id="cat_id" name="cat_id" value="{$goods_cat_id}">
						{if $is_add}
						<a href="javascript:void(0)" onclick="rapidCatAdd()" title="{$lang.rapid_add_cat}" class="special">{$lang.rapid_add_cat}</a>
						<span id="category_add" style="display:none;">
							<input class="text" size="10" name="addedCategoryName" />
							<a href="javascript:void(0)" onclick="addCategory()" title="{$lang.button_submit}" class="special">{$lang.button_submit}</a>
							<a href="javascript:void(0)" onclick="return goCatPage()" title="{$lang.category_manage}" class="special">{$lang.category_manage}</a>
							<a href="javascript:void(0)" onclick="hideCatDiv()" title="{$lang.hide}" class="special"></a>
						</span>
						{/if} {$lang.require_field}
						<script type="text/javascript">
                		$().ready(function(){
							// $("#cat_name")为获取分类名称的jQuery对象，可根据实际情况修改
							// $("#cat_id")为获取分类ID的jQuery对象，可根据实际情况修改
							// "{$goods_cat_id}"为被选中的商品分类编号，无则设置为null或者不写此参数或者为空字符串
							$.ajaxCategorySelecter($("#cat_name"), $("#cat_id"), "{$goods_cat_id}");
						});
            			</script>
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_other_cat}</td>
					<td>
						<input type="button" value="{$lang.add}" onclick="addOtherCat(this.parentNode)" class="button" />
						{foreach from=$goods.other_cat item=cat_id}
						<select name="other_cat[]">
							<option value="0">{$lang.select_please}</option>
							{$other_cat_list.$cat_id}
						</select>
						{/foreach}
						<select name="other_cat[]" onchange="hideCatDiv()" ><option value="0">{$lang.select_please}</option>{$cat_other_list}</select>
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_goods_brand}</td>
					<td>
						<!-- 代码修改_start_derek20150129admin_goods  bbs.hongyuvip.com -->

						<input id="brand_search" name="brand_search" type="text" value="{$brand_name_val|default:请输入……}" onclick="onC_search()" onblur="onB_search()" oninput="onK_search(this.value)" />
						<input id="brand_search_bf" name="brand_search_bf" type="hidden" value="{$brand_name_val}" />
						<input id="brand_search_jt" name="brand_search_jt" type="hidden" value="0" />
						<script language="javascript">
            function onC_search()
			{
				if (document.getElementById("brand_search").value == "请输入……")
					document.getElementById("brand_search").value = "";
				document.getElementById("brand_search_jt").value = 1;
				document.getElementById("brand_content").style.display = "block";
				$("div[id^='@']>div").css('display','block');
			}
            function onB_search()
			{
				if (document.getElementById("brand_search").value == "")
					document.getElementById("brand_search").value = document.getElementById("brand_search_bf").value;
				document.getElementById("brand_search_jt").value = 0;
			}
			function onK_search(w)
			{
				if (w != "")
				{
					$("div[id^='@']>div").css('display','none');
					$("div[id^='@']>div[id*='"+w+"']").css('display','block');
				}
				else
					$("div[id^='@']>div").css('display','block');
			}
            </script>

						<!-- 代码修改_end_derek20150129admin_goods  bbs.hongyuvip.com -->
						{if $is_add}
						<a href="javascript:void(0)" title="{$lang.rapid_add_brand}" onclick="rapidBrandAdd()" class="special">{$lang.rapid_add_brand}</a>
						<span id="brand_add" style="display:none;">
							<input class="text" size="15" name="addedBrandName" />
							<a href="javascript:void(0)" onclick="addBrand()" class="special">{$lang.button_submit}</a>
							<a href="javascript:void(0)" onclick="return goBrandPage()" title="{$lang.brand_manage}" class="special">{$lang.brand_manage}</a>
							<a href="javascript:void(0)" onclick="hideBrandDiv()" title="{$lang.hide}" class="special"><<</a>
						</span>
						{/if}

						<!-- 代码增加_start_derek20150129admin_goods  bbs.hongyuvip.com -->

						<div id="brand_content" style="margin-top:5px; margin-bottom:10px; display:none">
							<div style="float:left; overflow-y:scroll; width:420px; height:120px; border:#CCC 1px solid">
								<div id="xin_brand" style="display:none">新增品牌：</div>
								<table width="400" border="0" cellspacing="0" cellpadding="0">
									<!-- {if $brand_list_new ne ""} -->
									<tr>
										<td style="padding:5px 10px">A-G</td>
										<td style="padding:5px 10px">H-K</td>
										<td style="padding:5px 10px">L-S</td>
										<td style="padding:5px 10px">T-Z</td>
										<td style="padding:5px 10px">0-9</td>
									</tr>
									<tr>
										<td valign="top" style="padding-left:10px">
											<!-- {foreach from=$brand_list_new item=brand_list key=key} -->
											<!-- {if $brand_list.name_p >= "a" && $brand_list.name_p <= "g"} -->

											<div id="@{$key}">
												<div id="{$brand_list.name_pinyin}{$brand_list.name}">
													<a href="javascript:go_brand_id({$key},'{$brand_list.name}')">{$brand_list.name}</a>
												</div>
											</div>

											<!-- {/if} -->
											<!-- {/foreach} -->
										</td>
										<td valign="top" style="padding-left:10px">
											<!-- {foreach from=$brand_list_new item=brand_list key=key} -->
											<!-- {if $brand_list.name_p >= "h" && $brand_list.name_p <= "k"} -->

											<div id="@{$key}">
												<div id="{$brand_list.name_pinyin}{$brand_list.name}">
													<a href="javascript:go_brand_id({$key},'{$brand_list.name}')">{$brand_list.name}</a>
												</div>
											</div>

											<!-- {/if} -->
											<!-- {/foreach} -->
										</td>
										<td valign="top" style="padding-left:10px">
											<!-- {foreach from=$brand_list_new item=brand_list key=key} -->
											<!-- {if $brand_list.name_p >= "l" && $brand_list.name_p <= "s"} -->

											<div id="@{$key}">
												<div id="{$brand_list.name_pinyin}{$brand_list.name}">
													<a href="javascript:go_brand_id({$key},'{$brand_list.name}')">{$brand_list.name}</a>
												</div>
											</div>

											<!-- {/if} -->
											<!-- {/foreach} -->
										</td>
										<td valign="top" style="padding-left:10px">
											<!-- {foreach from=$brand_list_new item=brand_list key=key} -->
											<!-- {if $brand_list.name_p >= "t" && $brand_list.name_p <= "z"} -->

											<div id="@{$key}">
												<div id="{$brand_list.name_pinyin}{$brand_list.name}">
													<a href="javascript:go_brand_id({$key},'{$brand_list.name}')">{$brand_list.name}</a>
												</div>
											</div>

											<!-- {/if} -->
											<!-- {/foreach} -->
										</td>
										<td valign="top" style="padding-left:10px">
											<!-- {foreach from=$brand_list_new item=brand_list key=key} -->
											<!-- {if $brand_list.name_p >= "0" && $brand_list.name_p <= "9"} -->

											<div id="@{$key}">
												<div id="{$brand_list.name_pinyin}{$brand_list.name}">
													<a href="javascript:go_brand_id({$key},'{$brand_list.name}')">{$brand_list.name}</a>
												</div>
											</div>

											<!-- {/if} -->
											<!-- {/foreach} -->
										</td>
									</tr>
									<!-- {else} -->
									<tr>
										<td colspan="5" align="center">暂无数据……</td>
									</tr>
									<!-- {/if} -->
								</table>
							</div>
							<div style="padding:106px 0px 0px 426px">
								<a href="javascript:no_look_brand_content()">收起列表↑</a>
							</div>
						</div>

						<!-- {if $goods.goods_sn} -->

						<input type="hidden" name="brand_id" id="brand_id" value="{$goods.brand_id}" />

						<!-- {else} -->

						<input type="hidden" name="brand_id" id="brand_id" value="0" />

						<!-- {/if} -->
						<script language="javascript">
            function go_brand_id(id,name)
			{
				document.getElementById("brand_id").value = id;
				document.getElementById("brand_search").value = name;
				document.getElementById("brand_content").style.display = "none";
			}
			function no_look_brand_content()
			{
				document.getElementById("brand_content").style.display = "none";
			}
            </script>

						<!-- 代码增加_end_derek20150129admin_goods  bbs.hongyuvip.com -->
					</td>
				</tr>
				{if $suppliers_exists eq 1}
				<tr>
					<td class="label">{$lang.label_suppliers}</td>
					<td>
						<select name="suppliers_id" id="suppliers_id">
							<option value="0">{$lang.suppliers_no}</option>

							{html_options options=$suppliers_list_name selected=$goods.suppliers_id}

						</select>
					</td>
				</tr>
				{/if}
				<tr>
					<td class="label">{$lang.lab_shop_price}</td>
					<td>
						<input type="text" name="shop_price" value="{$goods.shop_price}" size="20" onblur="priceSetted()" />
						<input type="button" value="{$lang.compute_by_mp}" onclick="marketPriceSetted()" />
						{$lang.require_field}
					</td>
				</tr>
				{if $user_rank_list}
				<tr>
					<td class="label">
						<a href="javascript:showNotice('noticeUserPrice');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_user_price}
					</td>
					<td>
						{foreach from=$user_rank_list item=user_rank} {$user_rank.rank_name}
						<span id="nrank_{$user_rank.rank_id}"></span>
						<input type="text" id="rank_{$user_rank.rank_id}" name="user_price[]" value="{$member_price_list[$user_rank.rank_id]|default:-1}" onkeyup="if(parseInt(this.value)<-1){this.value='-1';};set_price_note({$user_rank.rank_id})" size="8" />
						<input type="hidden" name="user_rank[]" value="{$user_rank.rank_id}" />
						{/foreach}
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeUserPrice">{$lang.notice_user_price}</span>
					</td>
				</tr>
				{/if}

				<!--鍟嗗搧浼樻儬浠锋牸-->
				<tr>
					<td class="label">
						<a href="javascript:showNotice('volumePrice');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_volume_price}
					</td>
					<td>
						<table width="100%" id="tbody-volume" align="center">
							{foreach from=$volume_price_list item=volume_price name="volume_price_tab"}
							<tr>
								<td>
									{if $smarty.foreach.volume_price_tab.iteration eq 1}
									<a href="javascript:;" onclick="addVolumePrice(this)">[+]</a>
									{else}
									<a href="javascript:;" onclick="removeVolumePrice(this)">[-]</a>
									{/if} {$lang.volume_number}
									<input type="text" name="volume_number[]" size="8" value="{$volume_price.number}" />
									{$lang.volume_price}
									<input type="text" name="volume_price[]" size="8" value="{$volume_price.price}" />
								</td>
							</tr>
							{/foreach}
						</table>
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="volumePrice">{$lang.notice_volume_price}</span>
					</td>
				</tr>
				<!--鍟嗗搧浼樻儬浠锋牸 end -->

				<tr>
					<td class="label">{$lang.lab_market_price}</td>
					<td>
						<input type="text" name="market_price" value="{$goods.market_price}" size="20" />
						<input type="button" value="{$lang.integral_market_price}" onclick="integral_market_price()" />
					</td>
				</tr>
				<tr>
					<td class="label">
						<a href="javascript:showNotice('giveIntegral');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_give_integral}
					</td>
					<td>
						<input type="text" name="give_integral" value="{$goods.give_integral}" size="20" />
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="giveIntegral">{$lang.notice_give_integral}</span>
					</td>
				</tr>
				<tr>
					<td class="label">
						<a href="javascript:showNotice('rankIntegral');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_rank_integral}
					</td>
					<td>
						<input type="text" name="rank_integral" value="{$goods.rank_integral}" size="20" />
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="rankIntegral">{$lang.notice_rank_integral}</span>
					</td>
				</tr>
				<!-- <tr>
					<td class="label">
						<a href="javascript:showNotice('noticPoints');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_integral}
					</td>
					<td>
						<input type="text" name="integral" value="{$goods.integral}" size="20" onblur="parseint_integral()" ;/>
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticPoints">{$lang.notice_integral}</span>
					</td>
				</tr> -->
				<tr>
					<td class="label">
						<label for="is_promote">
							<input type="checkbox" id="is_promote" name="is_promote" value="1" {if $goods.is_promote}checked="checked" {/if} onclick="handlePromote(this.checked);" />
							{$lang.lab_promote_price}
						</label>
					</td>
					<td id="promote_3">
						<input type="text" id="promote_1" name="promote_price" value="{$goods.promote_price}" size="20" />
					</td>
				</tr>

				<tr id="promote_4">
					<td class="label" id="promote_5">{$lang.lab_promote_date}</td>
					<td id="promote_6">
						<input name="promote_start_date" type="text" id="promote_start_date" size="12" value='{$goods.promote_start_date}' readonly="readonly" />
						<input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('promote_start_date', '%Y-%m-%d', false, false, 'selbtn1');" value="{$lang.btn_select}" class="button" />
						-
						<input name="promote_end_date" type="text" id="promote_end_date" size="12" value='{$goods.promote_end_date}' readonly="readonly" />
						<input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('promote_end_date', '%Y-%m-%d', false, false, 'selbtn2');" value="{$lang.btn_select}" class="button" />
					</td>
				</tr>


				<tr>
					<td class="label">
						<label for="is_buy">
							<input type="checkbox" id="is_buy" name="is_buy" value="1" {if $goods.is_buy}checked="checked" {/if} onclick="handleBuy(this.checked);" />
							限购数量：
						</label>
					</td>
					<td id="promote_3">
						<input type="text" id="buymax" name="buymax" value="{$goods.buymax}" size="20" {if $goods.is_buy eq 0} disabled="disabled" {/if}/>
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="giveIntegral">表示限购日期内，每个用户最多只能购买多少件。0：表示不限购</span>
					</td>
				</tr>
				<tr id="promote_4">
					<td class="label">限购日期：</td>
					<td>
						<input name="buymax_start_date" type="text" id="buymax_start_date" size="12" value='{$goods.buymax_start_date}' readonly="readonly" />
						<input name="selbtn3" type="button" id="selbtn3" onclick="return showCalendar('buymax_start_date', '%Y-%m-%d', false, false, 'selbtn3');" value="{$lang.btn_select}" class="button" {if $goods.is_buy eq 0} disabled="disabled" {/if}/>
						-
						<input name="buymax_end_date" type="text" id="buymax_end_date" size="12" value='{$goods.buymax_end_date}' readonly="readonly" />
						<input name="selbtn4" type="button" id="selbtn4" onclick="return showCalendar('buymax_end_date', '%Y-%m-%d', false, false, 'selbtn4');" value="{$lang.btn_select}" class="button" {if $goods.is_buy eq 0} disabled="disabled" {/if}/>
					</td>
				</tr>

				<tr>
					<td class="label" id="promote_5">{$lang.lab_cost_price}</td>
					<td id="promote_7">
						<input type="text" id="promote_1" name="cost_price" value="{$goods.cost_price}" size="20" />
						<br />
						<span class="notice-span">{$lang.notice_cost_price}</span>
					</td>

				</tr>

				<tr>
					<td class="label">{$lang.lab_picture}</td>
					<td>
						<input type="file" name="goods_img" size="35" />
						{if $goods.goods_img}
						<a href="goods.php?act=show_image&img_url={$goods.goods_img}" target="_blank">
							<img src="images/yes.gif" border="0" />
						</a>
						{else}
						<img src="images/no.gif" />
						{/if}
						<br />
						<input type="text" size="40" value="{$lang.lab_picture_url}" style="color:#aaa;" onfocus="if (this.value == '{$lang.lab_picture_url}'){this.value='http://';this.style.color='#000';}" name="goods_img_url" />
					</td>
				</tr>
				<tr id="auto_thumb_1">
					<td class="label">{$lang.lab_thumb}</td>
					<td id="auto_thumb_3">
						<input type="file" name="goods_thumb" size="35" />
						{if $goods.goods_thumb}
						<a href="goods.php?act=show_image&img_url={$goods.goods_thumb}" target="_blank">
							<img src="images/yes.gif" border="0" />
						</a>
						{else}
						<img src="images/no.gif" />
						{/if}
						<br />
						<input type="text" size="40" value="{$lang.lab_thumb_url}" style="color:#aaa;" onfocus="if (this.value == '{$lang.lab_thumb_url}'){this.value='http://';this.style.color='#000';}" name="goods_thumb_url" />
						{if $gd > 0}
						<br />
						<label for="auto_thumb">
							<input type="checkbox" id="auto_thumb" name="auto_thumb" checked="true" value="1" onclick="handleAutoThumb(this.checked)" />
							{$lang.auto_thumb}
						</label>
						{/if}
					</td>
				</tr>
				<!--代码增加_start byjdy-->
				<tr>
					<td class="label">
						<font color=#ff3300>是否显示在频道首页：</font>
					</td>
					<td>
						<input type="checkbox" name="is_catindex" value="1" {if $goods.is_catindex}checked="checked" {/if} />
						打勾表示在频道首页显示，否则不显示。
					</td>
				</tr>
				<!--代码增加_end byjdy-->
				{* 代码增加_start By bbs.hongyuvip.com *}
				<!--{if $goods.supplier_id}-->
				<tr>
					<td class="label">审核状态</td>
					<td>
						<input type="radio" name="supplier_status" value="1" {if $goods.supplier_status eq '1'}checked=checked{/if}>
						审核通过
						<input type="radio" name="supplier_status" value="0" {if $goods.supplier_status eq '0'}checked=checked{/if}>
						未审核
						<input type="radio" name="supplier_status" value="-1" {if $goods.supplier_status eq '-1'}checked=checked{/if}>
						审核未通过
					</td>
				</tr>
				<tr>
					<td class="label">审核消息</td>
					<td>
						<textarea name="supplier_status_txt" rows=4 cols=50>{$goods.supplier_status_txt}</textarea>
					</td>
				</tr>
				<!--{/if}-->
				{* 代码增加_end By bbs.hongyuvip.com *}
			</table>

			<!-- 璇︾粏鎻忚堪 -->
			<table width="100%" id="detail-table" style="display:none">
				<tr>
					<td>{$FCKeditor}</td>
				</tr>
			</table>

			<!-- 鍏朵粬淇℃伅 -->
			<table width="90%" id="mix-table" style="display:none" align="center">
				{if $code eq ''}
				<tr>
					<td class="label">{$lang.lab_goods_weight}</td>
					<td>
						<input type="text" name="goods_weight" value="{$goods.goods_weight_by_unit}" size="20" />
						<select name="weight_unit"> {html_options options=$unit_list selected=$weight_unit}
						</select>
					</td>
				</tr>
				{/if} {if $cfg.use_storage}
				<tr>
					<td class="label">
						<a href="javascript:showNotice('noticeStorage');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_goods_number}
					</td>
					<!--            <td><input type="text" name="goods_number" value="{$goods.goods_number}" size="20" {if $code neq '' || $goods._attribute neq ''}readonly="readonly"{/if} /><br />-->
					<td>
						<input type="text" name="goods_number" value="{$goods.goods_number}" size="20" />
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeStorage">{$lang.notice_storage}</span>
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_warn_number}</td>
					<td>
						<input type="text" name="warn_number" value="{$goods.warn_number}" size="20" />
					</td>
				</tr>
				{/if}
				<tr>
					<td class="label">{$lang.lab_intro}</td>
					<td>
						<input type="checkbox" name="is_best" value="1" {if $goods.is_best}checked="checked" {/if} />
						{$lang.is_best}
						<input type="checkbox" name="is_new" value="1" {if $goods.is_new}checked="checked" {/if} />
						{$lang.is_new}
						<input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked" {/if} />
						{$lang.is_hot}
					</td>
				</tr>
				<tr id="alone_sale_1">
					<td class="label" id="alone_sale_2">{$lang.lab_is_on_sale}</td>
					<td id="alone_sale_3">
						<input type="checkbox" name="is_on_sale" value="1" {if $goods.is_on_sale}checked="checked" {/if} />
						{$lang.on_sale_desc}
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_is_alone_sale}</td>
					<td>
						<input type="checkbox" name="is_alone_sale" value="1" {if $goods.is_alone_sale}checked="checked" {/if} />
						{$lang.alone_sale}
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_is_free_shipping}</td>
					<td>
						<input type="checkbox" name="is_shipping" value="1" {if $goods.is_shipping}checked="checked" {/if} />
						{$lang.free_shipping}
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_keywords}</td>
					<td>
						<input type="text" name="keywords" value="{$goods.keywords|escape}" size="40" />
						{$lang.notice_keywords}
					</td>
				</tr>
				<tr>
					<td class="label">{$lang.lab_goods_brief}</td>
					<td>
						<textarea name="goods_brief" cols="40" rows="3">{$goods.goods_brief|escape}</textarea>
					</td>
				</tr>
				<tr>
					<td class="label">
						<a href="javascript:showNotice('noticeSellerNote');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_seller_note}
					</td>
					<td>
						<textarea name="seller_note" cols="40" rows="3">{$goods.seller_note}</textarea>
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeSellerNote">{$lang.notice_seller_note}</span>
					</td>
				</tr>
			</table>

			<!-- 灞炴€т笌瑙勬牸 -->
			{if $goods_type_list}
			<table width="100%" id="properties-table" style="display:none" align="center">
				<tr>
					<td class="label">
						<a href="javascript:showNotice('noticeGoodsType');" title="{$lang.form_notice}">
							<img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
						</a>
						{$lang.lab_goods_type}
					</td>
					<td>
						<select name="goods_type" onchange="getAttrList({$goods.goods_id})">
							<option value="0">{$lang.sel_goods_type}</option>

							{$goods_type_list}

						</select>
						<br />
						<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsType">{$lang.notice_goods_type}</span>
					</td>
				</tr>
				<tr>
					<td id="tbody-goodsAttr" colspan="2" style="padding:0">{$goods_attr_html}</td>
				</tr>
			</table>
			{/if}

			<!--代码修改_start By bbs.hongyuvip.com  将 商品相册 这部分代码完全修改成下面这样-->
			<table width="100%" id="gallery-table" style="display:none" align="center">
				<!-- 图片列表 -->
				<tr>
					<td>
						<style>
.attr-color-div {
	width: 100%;
	background: #BBDDE5;
	text-indent: 10px;
	height: 26px;
	padding-top: 1px;
}

.attr-front {
	background: #CCFF99;
	line-height: 24px;
	font-weight: bold;
	padding: 6px 15px 6px 18px;
}

.attr-back {
	color: #FF0000;
	font-weight: bold;
	line-height: 24px;
	padding: 6px 15px 6px 18px;
	border-right: 1px solid #FFF;
}
</style>
						<?php
			$sql_www_ecshop68_com="SELECT ga.goods_attr_id, ga.attr_id, ga.attr_value FROM ". $GLOBALS['ecs']->table('attribute') . " AS a left join ". $GLOBALS['ecs']->table('goods_attr') . "  AS ga on a.attr_id=ga.attr_id  WHERE a.is_attr_gallery=1 and ga.goods_id='" . $GLOBALS['smarty']->_var['goods']['goods_id']. "' order by ga.goods_attr_id ";
			$color_list_www_ecshop68_com=$GLOBALS['db']->getAll($sql_www_ecshop68_com);
			$color_count_df67sd6h8as5fc63xcq892jkb_www_ecshop68_com=count($color_list_www_ecshop68_com);
			$color_list_www_ecshop68_com[$color_count_df67sd6h8as5fc63xcq892jkb_www_ecshop68_com]=array('attr_id'=>0, 'attr_value'=>'通用');
			$GLOBALS['smarty']->assign('color_list_www_ecshop68_com', $color_list_www_ecshop68_com);
			$GLOBALS['smarty']->assign('color_count_df67sd6h8as5fc63xcq892jkb_www_ecshop68_com', $color_count_df67sd6h8as5fc63xcq892jkb_www_ecshop68_com+1);
			?>
						<script>
			{literal}
			function changeCurrentColor(n)
			{
			for(i=1;i<={$color_count_df67sd6h8as5fc63xcq892jkb_www_ecshop68_com};i++)
			{
				document.getElementById("color_" + i).className = "attr-back";
			}
			document.getElementById("color_" + n).className = "attr-front";
			}
			{/literal}
			</script>
						<font color=#ff3300>请选择商品颜色</font>
						（点击下面不同颜色切换到该颜色对应的相册）
						<br>
						<br>
						<div class="attr-color-div">
							{foreach from=$color_list_www_ecshop68_com name=color_list item=color_qq}
							<span class="{if $smarty.foreach.color_list.iteration eq 1}attr-front{else}attr-back{/if}" id="color_{$smarty.foreach.color_list.iteration}">
								<a href="attr_img_upload.php?goods_id={$goods.goods_id}&goods_attr_id={$color_qq.goods_attr_id}" onclick="javascript:changeCurrentColor({$smarty.foreach.color_list.iteration})" target="attr_upload">{$color_qq.attr_value}</a>
							</span>
							{/foreach}
						</div>
						<iframe name="attr_upload" src="attr_img_upload.php?goods_id={$goods.goods_id}&goods_attr_id={$color_list_www_ecshop68_com.0.goods_attr_id}" frameborder=1 scrolling=no width="100%" height="auto" style="min-height:630px; border:1px #eee solid; margin-top:5px;"> </iframe>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
				</tr>
			</table>

			<!--代码修改_end By bbs.hongyuvip.com-->

			<!-- 鍏宠仈鍟嗗搧 -->
			<table width="90%" id="linkgoods-table" style="display:none" align="center">
				<!-- 鍟嗗搧鎼滅储 -->
				<tr>
					<td colspan="3">
						<img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
						<select name="cat_id1">
							<option value="0">{$lang.all_category}{$cat_list}
						</select>
						<select name="brand_id1">
							<option value="0">{$lang.all_brand}{html_options options=$brand_list}
						</select>
						<input type="text" name="keyword1" />
						<input type="button" value="{$lang.button_search}" class="button" onclick="searchGoods(sz1, 'cat_id1','brand_id1','keyword1')" />
					</td>
				</tr>
				<!-- 鍟嗗搧鍒楄〃 -->
				<tr>
					<th>{$lang.all_goods}</th>
					<th>{$lang.handler}</th>
					<th>{$lang.link_goods}</th>
				</tr>
				<tr>
					<td width="42%">
						<select name="source_select1" size="20" style="width:100%" ondblclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" multiple="true">
						</select>
					</td>
					<td align="center">
						<p>
							<input name="is_single" type="radio" value="1" checked="checked" />
							{$lang.single}
							<br />
							<input name="is_single" type="radio" value="0" />
							{$lang.double}
						</p>
						<p>
							<input type="button" value=">>" onclick="sz1.addItem(true, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" />
						</p>
						<p>
							<input type="button" value=">" onclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" />
						</p>
						<p>
							<input type="button" value="<" onclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
						<p>
							<input type="button" value="<<" onclick="sz1.dropItem(true, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
					</td>
					<td width="42%">
						<select name="target_select1" size="20" style="width:100%" multiple ondblclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)">

							{foreach from=$link_goods_list item=link_goods}

							<option value="{$link_goods.goods_id}">{$link_goods.goods_name}</option>

							{/foreach}

						</select>
					</td>
				</tr>
			</table>

			<!-- 閰嶄欢 -->
			<table width="90%" id="groupgoods-table" style="display:none" align="center">
				<!-- 鍟嗗搧鎼滅储 -->
				<tr>
					<td colspan="3">
						<img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
						<select name="cat_id2">
							<option value="0">{$lang.all_category}{$cat_list}
						</select>
						<select name="brand_id2">
							<option value="0">{$lang.all_brand}{html_options options=$brand_list}
						</select>
						<input type="text" name="keyword2" />
						<input type="button" value="{$lang.button_search}" onclick="searchGoods(sz2, 'cat_id2', 'brand_id2', 'keyword2')" class="button" />
					</td>
				</tr>
				<!-- 鍟嗗搧鍒楄〃 -->
				<tr>
					<th>{$lang.all_goods}</th>
					<th>{$lang.handler}</th>
					<th>{$lang.group_goods}</th>
				</tr>
				<tr>
					<td width="42%">
						<select name="source_select2" size="20" style="width:100%" onchange="sz2.priceObj.value = this.options[this.selectedIndex].id" ondblclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)">
						</select>
					</td>
					<td align="center">
						<p>
							{$lang.price}
							<br />
							<input name="price2" type="text" size="6" />
						</p>
						<p>
							<input type="button" value=">" onclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)" class="button" />
						</p>
						<p>
							<input type="button" value="<" onclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
						<p>
							<input type="button" value="<<" onclick="sz2.dropItem(true, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
					</td>
					<td width="42%">
						<select name="target_select2" size="20" style="width:100%" multiple ondblclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)">

							{foreach from=$group_goods_list item=group_goods}

							<option value="{$group_goods.goods_id}">{$group_goods.goods_name}</option>

							{/foreach}

						</select>
					</td>
				</tr>
			</table>

			<!-- 鍏宠仈鏂囩珷 -->
			<table width="90%" id="article-table" style="display:none" align="center">
				<!-- 鏂囩珷鎼滅储 -->
				<tr>
					<td colspan="3">
						<img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
						{$lang.article_title}
						<input type="text" name="article_title" />
						<input type="button" value="{$lang.button_search}" onclick="searchArticle()" class="button" />
					</td>
				</tr>
				<!-- 鏂囩珷鍒楄〃 -->
				<tr>
					<th>{$lang.all_article}</th>
					<th>{$lang.handler}</th>
					<th>{$lang.goods_article}</th>
				</tr>
				<tr>
					<td width="45%">
						<select name="source_select3" size="20" style="width:100%" multiple ondblclick="sz3.addItem(false, 'add_goods_article', goodsId, this.form.elements['price2'].value)">
						</select>
					</td>
					<td align="center">
						<p>
							<input type="button" value=">>" onclick="sz3.addItem(true, 'add_goods_article', goodsId, this.form.elements['price2'].value)" class="button" />
						</p>
						<p>
							<input type="button" value=">" onclick="sz3.addItem(false, 'add_goods_article', goodsId, this.form.elements['price2'].value)" class="button" />
						</p>
						<p>
							<input type="button" value="<" onclick="sz3.dropItem(false, 'drop_goods_article', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
						<p>
							<input type="button" value="<<" onclick="sz3.dropItem(true, 'drop_goods_article', goodsId, elements['is_single'][0].checked)" class="button" />
						</p>
					</td>
					<td width="45%">
						<select name="target_select3" size="20" style="width:100%" multiple ondblclick="sz3.dropItem(false, 'drop_goods_article', goodsId, elements['is_single'][0].checked)">

							{foreach from=$goods_article_list item=goods_article}

							<option value="{$goods_article.article_id}">{$goods_article.title}</option>

							{/foreach}

						</select>
					</td>
				</tr>
			</table>
			<div class="button-div">
				<input type="hidden" name="goods_id" value="{$goods.goods_id}" />
				{if $code neq ''}
				<input type="hidden" name="extension_code" value="{$code}" />
				{/if}

				<!--修改代码_start By bbs.hongyuvip.com 主要是给这两个INPUT各自增加了一个ID， id="goods_info_submit"  id="goods_info_reset" -->
				<input id="goods_info_submit" type="submit" value="{$lang.button_submit}" class="button" />
				<input id="goods_info_reset" type="reset" value="{$lang.button_reset}" class="button" />
				<!--修改代码_end By bbs.hongyuvip.com-->

			</div>
			<input type="hidden" name="act" value="{$form_act}" />
		</form>
	</div>
</div>
<!-- end goods form -->
{insert_scripts files="validator.js,tab.js"}
<script language="JavaScript">
  var goodsId = '{$goods.goods_id}';
  var elements = document.forms['theForm'].elements;
  var sz1 = new SelectZone(1, elements['source_select1'], elements['target_select1']);
  var sz2 = new SelectZone(2, elements['source_select2'], elements['target_select2'], elements['price2']);
  var sz3 = new SelectZone(1, elements['source_select3'], elements['target_select3']);
  var marketPriceRate = {$cfg.market_price_rate|default:1};
  var integralPercent = {$cfg.integral_percent|default:0};

  {literal}
  onload = function()
  {
      handlePromote(document.forms['theForm'].elements['is_promote'].checked);

      if (document.forms['theForm'].elements['auto_thumb'])
      {
          handleAutoThumb(document.forms['theForm'].elements['auto_thumb'].checked);
      }

      // 妫€鏌ユ柊璁㈠崟
      startCheckOrder();
      {/literal}
      {foreach from=$user_rank_list item=item}
      set_price_note({$item.rank_id});
      {/foreach}
      {literal}
      document.forms['theForm'].reset();
  }

  function validate(goods_id)
  {
      var validator = new Validator('theForm');
      var goods_sn  = document.forms['theForm'].elements['goods_sn'].value;

      validator.required('goods_name', goods_name_not_null);
      if (document.forms['theForm'].elements['cat_id'].value == 0)
      {
          validator.addErrorMsg(goods_cat_not_null);
      }

      checkVolumeData("1",validator);

      validator.required('shop_price', shop_price_not_null);
      validator.isNumber('shop_price', shop_price_not_number, true);
      validator.isNumber('market_price', market_price_not_number, false);
      if (document.forms['theForm'].elements['is_promote'].checked)
      {
          validator.required('promote_start_date', promote_start_not_null);
          validator.required('promote_end_date', promote_end_not_null);
          validator.islt('promote_start_date', 'promote_end_date', promote_not_lt);
      }

      if (document.forms['theForm'].elements['goods_number'] != undefined)
      {
          validator.isInt('goods_number', goods_number_not_int, false);
          validator.isInt('warn_number', warn_number_not_int, false);
      }

      var callback = function(res)
     {
      if (res.error > 0)
      {
        alert("{$lang.goods_sn_exists}");
      }
      else
      {
         if(validator.passed())
         {
         document.forms['theForm'].submit();
         }
      }
  }
    Ajax.call('goods.php?is_ajax=1&act=check_goods_sn', "goods_sn=" + goods_sn + "&goods_id=" + goods_id, callback, "GET", "JSON");
}

  /**
   * 鍒囨崲鍟嗗搧绫诲瀷
   */
  function getAttrList(goodsId)
  {
      var selGoodsType = document.forms['theForm'].elements['goods_type'];

      if (selGoodsType != undefined)
      {
          var goodsType = selGoodsType.options[selGoodsType.selectedIndex].value;

          Ajax.call('goods.php?is_ajax=1&act=get_attr', 'goods_id=' + goodsId + "&goods_type=" + goodsType, setAttrList, "GET", "JSON");
      }
  }
function array_search_value(arrayinfo,value){
	for(i in arrayinfo){
		if(arrayinfo[i] == value){
			return false;
		}
	}
	return true;
}

  ///条形码选择传值

function getType(txm,id,value,good_id)
{
	
	var txm = txm;
	var cid = id;//所选属性的上级ID
	var val = value;//选中的值
	var goodid = good_id;//商品id
	var parm = new Array();
	var j = 0;
	$('.ctxm_'+txm).each(function(k,v){
		if(array_search_value(parm,v.value)){
			parm[j] = v.value;
			j++;
		}
	})
	
	var par_str = '';
	var parm_key = '';
	var parm_value = '';
	for(i in parm){
		parm_key = '&attr_'+parm[i]+'='; 
		parm_value = '';
		$('.attr_num_'+parm[i]).each(function(key,value){
			if(value.value !=''){
				parm_value += value.value+',';
			}
		})
		par_str += parm_key+parm_value;
	}
	
	Ajax.call('goods.php?is_ajax=1&act=get_txm', 'goods_id=' + goodid + "&id=" + id + par_str , chu, "GET", "JSON");
	
	return;
}
/*条形码数据返回*/
function chu (result)
{
	var opanel = document.getElementById("input_txm");
	var zhi = result.content;
	opanel.innerHTML = zhi;
}
  function setAttrList(result, text_result)
  {
    document.getElementById('tbody-goodsAttr').innerHTML = result.content;
  }

  /**
   * 鎸夋瘮渚嬭?绠椾环鏍
   * @param   string  inputName   杈撳叆妗嗗悕绉
   * @param   float   rate        姣斾緥
   * @param   string  priceName   浠锋牸杈撳叆妗嗗悕绉帮紙濡傛灉娌℃湁锛屽彇shop_price锛
   */
  function computePrice(inputName, rate, priceName)
  {
      var shopPrice = priceName == undefined ? document.forms['theForm'].elements['shop_price'].value : document.forms['theForm'].elements[priceName].value;
      shopPrice = Utils.trim(shopPrice) != '' ? parseFloat(shopPrice)* rate : 0;
      if(inputName == 'integral')
      {
          shopPrice = parseInt(shopPrice);
      }
      shopPrice += "";

      n = shopPrice.lastIndexOf(".");
      if (n > -1)
      {
          shopPrice = shopPrice.substr(0, n + 3);
      }

      if (document.forms['theForm'].elements[inputName] != undefined)
      {
          document.forms['theForm'].elements[inputName].value = shopPrice;
      }
      else
      {
          document.getElementById(inputName).value = shopPrice;
      }
  }

  /**
   * 璁剧疆浜嗕竴涓?晢鍝佷环鏍硷紝鏀瑰彉甯傚満浠锋牸銆佺Н鍒嗕互鍙婁細鍛樹环鏍
   */
  function priceSetted()
  {
    computePrice('market_price', marketPriceRate);
    computePrice('integral', integralPercent / 100);
    {/literal}
    {foreach from=$user_rank_list item=item}
    set_price_note({$item.rank_id});
    {/foreach}
    {literal}
  }

  /**
   * 璁剧疆浼氬憳浠锋牸娉ㄩ噴
   */
  function set_price_note(rank_id)
  {
    var shop_price = parseFloat(document.forms['theForm'].elements['shop_price'].value);

    var rank = new Array();
    {/literal}
    {foreach from=$user_rank_list item=item}
    rank[{$item.rank_id}] = {$item.discount|default:100};
    {/foreach}
    {literal}
    if (shop_price >0 && rank[rank_id] && document.getElementById('rank_' + rank_id) && parseInt(document.getElementById('rank_' + rank_id).value) == -1)
    {
      var price = parseInt(shop_price * rank[rank_id] + 0.5) / 100;
      if (document.getElementById('nrank_' + rank_id))
      {
        document.getElementById('nrank_' + rank_id).innerHTML = '(' + price + ')';
      }
    }
    else
    {
      if (document.getElementById('nrank_' + rank_id))
      {
        document.getElementById('nrank_' + rank_id).innerHTML = '';
      }
    }
  }

  /**
   * 鏍规嵁甯傚満浠锋牸锛岃?绠楀苟鏀瑰彉鍟嗗簵浠锋牸銆佺Н鍒嗕互鍙婁細鍛樹环鏍
   */
  function marketPriceSetted()
  {
    computePrice('shop_price', 1/marketPriceRate, 'market_price');
    computePrice('integral', integralPercent / 100);
    {/literal}
    {foreach from=$user_rank_list item=item}
    set_price_note({$item.rank_id});
    {/foreach}
    {literal}
  }

  /**
   * 鏂板?涓€涓??鏍
   */
  function addSpec(obj)
  {
      var src   = obj.parentNode.parentNode;
      var idx   = rowindex(src);
      var tbl   = document.getElementById('attrTable');
      var row   = tbl.insertRow(idx + 1);
      var cell1 = row.insertCell(-1);
      var cell2 = row.insertCell(-1);
      var regx  = /<a([^>]+)<\/a>/i;

      cell1.className = 'label';
      cell1.innerHTML = src.childNodes[0].innerHTML.replace(/(.*)(addSpec)(.*)(\[)(\+)/i, "$1removeSpec$3$4-");
      cell2.innerHTML = src.childNodes[1].innerHTML.replace(/readOnly([^\s|>]*)/i, '');
  }

  /**
   * 鍒犻櫎瑙勬牸鍊
   */
  function removeSpec(obj)
  {
      var row = rowindex(obj.parentNode.parentNode);
      var tbl = document.getElementById('attrTable');

      tbl.deleteRow(row);
  }

  /**
   * 澶勭悊瑙勬牸
   */
  function handleSpec()
  {
      var elementCount = document.forms['theForm'].elements.length;
      for (var i = 0; i < elementCount; i++)
      {
          var element = document.forms['theForm'].elements[i];
          if (element.id.substr(0, 5) == 'spec_')
          {
              var optCount = element.options.length;
              var value = new Array(optCount);
              for (var j = 0; j < optCount; j++)
              {
                  value[j] = element.options[j].value;
              }

              var hiddenSpec = document.getElementById('hidden_' + element.id);
              hiddenSpec.value = value.join(String.fromCharCode(13)); // 鐢ㄥ洖杞﹂敭闅斿紑姣忎釜瑙勬牸
          }
      }
      return true;
  }

  function handlePromote(checked)
  {
      document.forms['theForm'].elements['promote_price'].disabled = !checked;
      document.forms['theForm'].elements['selbtn1'].disabled = !checked;
      document.forms['theForm'].elements['selbtn2'].disabled = !checked;
  }

   function handleBuy(checked)
  {
      document.forms['theForm'].elements['buymax'].disabled = !checked;
      document.forms['theForm'].elements['selbtn3'].disabled = !checked;
      document.forms['theForm'].elements['selbtn4'].disabled = !checked;
  }
  function handleAutoThumb(checked)
  {
      document.forms['theForm'].elements['goods_thumb'].disabled = checked;
      document.forms['theForm'].elements['goods_thumb_url'].disabled = checked;
  }

  /**
   * 蹇?€熸坊鍔犲搧鐗
   */
  function rapidBrandAdd(conObj)
  {
      var brand_div = document.getElementById("brand_add");

      if(brand_div.style.display != '')
      {
          var brand =document.forms['theForm'].elements['addedBrandName'];
          brand.value = '';
          brand_div.style.display = '';
      }
  }

  function hideBrandDiv()
  {
      var brand_add_div = document.getElementById("brand_add");
      if(brand_add_div.style.display != 'none')
      {
          brand_add_div.style.display = 'none';
      }
  }

  function goBrandPage()
  {
      if(confirm(go_brand_page))
      {
          window.location.href='brand.php?act=add';
      }
      else
      {
          return;
      }
  }

  function rapidCatAdd()
  {
      var cat_div = document.getElementById("category_add");

      if(cat_div.style.display != '')
      {
          var cat =document.forms['theForm'].elements['addedCategoryName'];
          cat.value = '';
          cat_div.style.display = '';
      }
  }

  function addBrand()
  {
      var brand = document.forms['theForm'].elements['addedBrandName'];
      if(brand.value.replace(/^\s+|\s+$/g, '') == '')
      {
          alert(brand_cat_not_null);
          return;
      }

      var params = 'brand=' + brand.value;
      Ajax.call('brand.php?is_ajax=1&act=add_brand', params, addBrandResponse, 'GET', 'JSON');
  }

  function addBrandResponse(result)
  {
      if (result.error == '1' && result.message != '')
      {
          alert(result.message);
          return;
      }

      var brand_div = document.getElementById("brand_add");
      brand_div.style.display = 'none';

      var response = result.content;

	  // 代码增加_start_derek20150129admin_goods  bbs.hongyuvip.com
	  
	  document.getElementById("brand_search").value = response.brand;
	  document.getElementById("brand_id").value = response.id;
	  document.getElementById("xin_brand").innerHTML += "&nbsp;[<a href=javascript:go_brand_id("+response.id+",'"+response.brand+"')>"+response.brand+"</a>]&nbsp;";
	  document.getElementById("xin_brand").style.display = "block";

	  // 代码增加_end_derek20150129admin_goods  bbs.hongyuvip.com

      var selCat = document.forms['theForm'].elements['brand_id'];
      var opt = document.createElement("OPTION");
      opt.value = response.id;
      opt.selected = true;
      opt.text = response.brand;

      if (Browser.isIE)
      {
          selCat.add(opt);
      }
      else
      {
          selCat.appendChild(opt);
      }

      return;
  }

  function addCategory()
  {
      var parent_id = document.forms['theForm'].elements['cat_id'];
      var cat = document.forms['theForm'].elements['addedCategoryName'];
      if(cat.value.replace(/^\s+|\s+$/g, '') == '')
      {
          alert(category_cat_not_null);
          return;
      }
      
      var params = 'parent_id=' + parent_id.value;
      params += '&cat=' + cat.value;
      Ajax.call('category.php?is_ajax=1&act=add_category', params, addCatResponse, 'GET', 'JSON');
  }

  function hideCatDiv()
  {
      var category_add_div = document.getElementById("category_add");
      if(category_add_div.style.display != null)
      {
          category_add_div.style.display = 'none';
      }
  }

  function addCatResponse(result)
  {
      if (result.error == '1' && result.message != '')
      {
          alert(result.message);
          return;
      }

      var category_add_div = document.getElementById("category_add");
      category_add_div.style.display = 'none';

      var response = result.content;
      
      $("#cat_id").val(response.id);
      $("#cat_name").val(response.cat);
      $("#cat_name").attr("nowvalue", response.cat);
      
      $.ajaxCategorySelecter($("#cat_name"), $("#cat_id"), response.id);

      return;
      
      var selCat = document.forms['theForm'].elements['cat_id'];
      var opt = document.createElement("OPTION");
      opt.value = response.id;
      opt.selected = true;
      opt.innerHTML = response.cat;

      //鑾峰彇瀛愬垎绫荤殑绌烘牸鏁
      var str = selCat.options[selCat.selectedIndex].text;
      var temp = str.replace(/^\s+/g, '');
      var lengOfSpace = str.length - temp.length;
      if(response.parent_id != 0)
      {
          lengOfSpace += 4;
      }
      for (i = 0; i < lengOfSpace; i++)
      {
          opt.innerHTML = '&nbsp;' + opt.innerHTML;
      }

      for (i = 0; i < selCat.length; i++)
      {
          if(selCat.options[i].value == response.parent_id)
          {
              if(i == selCat.length)
              {
                  if (Browser.isIE)
                  {
                      selCat.add(opt);
                  }
                  else
                  {
                      selCat.appendChild(opt);
                  }
              }
              else
              {
                  selCat.insertBefore(opt, selCat.options[i + 1]);
              }
              //opt.selected = true;
              break;
          }

      }

      return;
  }

    function goCatPage()
    {
        if(confirm(go_category_page))
        {
            window.location.href='category.php?act=add';
        }
        else
        {
            return;
        }
    }


  /**
   * 鍒犻櫎蹇?€熷垎绫
   */
  function removeCat()
  {
      if(!document.forms['theForm'].elements['parent_cat'] || !document.forms['theForm'].elements['new_cat_name'])
      {
          return;
      }

      var cat_select = document.forms['theForm'].elements['parent_cat'];
      var cat = document.forms['theForm'].elements['new_cat_name'];

      cat.parentNode.removeChild(cat);
      cat_select.parentNode.removeChild(cat_select);
  }

  /**
   * 鍒犻櫎蹇?€熷搧鐗
   */
  function removeBrand()
  {
      if (!document.forms['theForm'].elements['new_brand_name'])
      {
          return;
      }

      var brand = document.theForm.new_brand_name;
      brand.parentNode.removeChild(brand);
  }

  /**
   * 娣诲姞鎵╁睍鍒嗙被
   */
  function addOtherCat(conObj)
  {
      var sel = document.createElement("SELECT");
      var selCat = document.forms['theForm'].elements['other_cat[]'][0];
      
      if(selCat.length == undefined)
      {
    	  selCat = document.forms['theForm'].elements['other_cat[]'];
      }

      for (i = 0; i < selCat.length; i++)
      {
          var opt = document.createElement("OPTION");
          opt.text = selCat.options[i].text;
          opt.value = selCat.options[i].value;
          if (Browser.isIE)
          {
              sel.add(opt);
          }
          else
          {
              sel.appendChild(opt);
          }
      }
      conObj.appendChild(sel);
      sel.name = "other_cat[]";
      sel.onChange = function() {checkIsLeaf(this);};
  }

  /* 鍏宠仈鍟嗗搧鍑芥暟 */
  function searchGoods(szObject, catId, brandId, keyword)
  {
      var filters = new Object;

      filters.cat_id = elements[catId].value;
      filters.brand_id = elements[brandId].value;
      filters.keyword = Utils.trim(elements[keyword].value);
      filters.exclude = document.forms['theForm'].elements['goods_id'].value;

      szObject.loadOptions('get_goods_list', filters);
  }

  /**
   * 鍏宠仈鏂囩珷鍑芥暟
   */
  function searchArticle()
  {
    var filters = new Object;

    filters.title = Utils.trim(elements['article_title'].value);

    sz3.loadOptions('get_article_list', filters);
  }

  /**
   * 鏂板?涓€涓?浘鐗
   */
  function addImg(obj)
  {
      var src  = obj.parentNode.parentNode;
      var idx  = rowindex(src);
      var tbl  = document.getElementById('gallery-table');
      var row  = tbl.insertRow(idx + 1);
      var cell = row.insertCell(-1);
      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");
  }

  /**
   * 鍒犻櫎鍥剧墖涓婁紶
   */
  function removeImg(obj)
  {
      var row = rowindex(obj.parentNode.parentNode);
      var tbl = document.getElementById('gallery-table');

      tbl.deleteRow(row);
  }

  /**
   * 鍒犻櫎鍥剧墖
   */
  function dropImg(imgId)
  {
    Ajax.call('goods.php?is_ajax=1&act=drop_image', "img_id="+imgId, dropImgResponse, "GET", "JSON");
  }

  function dropImgResponse(result)
  {
      if (result.error == 0)
      {
          document.getElementById('gallery_' + result.content).style.display = 'none';
      }
  }

  /**
   * 灏嗗競鍦轰环鏍煎彇鏁
   */
  function integral_market_price()
  {
    document.forms['theForm'].elements['market_price'].value = parseInt(document.forms['theForm'].elements['market_price'].value);
  }

   /**
   * 灏嗙Н鍒嗚喘涔伴?搴﹀彇鏁
   */
  function parseint_integral()
  {
    document.forms['theForm'].elements['integral'].value = parseInt(document.forms['theForm'].elements['integral'].value);
  }


  /**
  * 妫€鏌ヨ揣鍙锋槸鍚﹀瓨鍦
  */
  function checkGoodsSn(goods_sn, goods_id)
  {
    if (goods_sn == '')
    {
        document.getElementById('goods_sn_notice').innerHTML = "";
        return;
    }

    var callback = function(res)
    {
      if (res.error > 0)
      {
        document.getElementById('goods_sn_notice').innerHTML = res.message;
        document.getElementById('goods_sn_notice').style.color = "red";
      }
      else
      {
        document.getElementById('goods_sn_notice').innerHTML = "";
      }
    }
    Ajax.call('goods.php?is_ajax=1&act=check_goods_sn', "goods_sn=" + goods_sn + "&goods_id=" + goods_id, callback, "GET", "JSON");
  }

  /**
   * 鏂板?涓€涓?紭鎯犱环鏍
   */
  function addVolumePrice(obj)
  {
    var src      = obj.parentNode.parentNode;
    var tbl      = document.getElementById('tbody-volume');

    var validator  = new Validator('theForm');
    checkVolumeData("0",validator);
    if (!validator.passed())
    {
      return false;
    }

    var row  = tbl.insertRow(tbl.rows.length);
    var cell = row.insertCell(-1);
    cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addVolumePrice)(.*)(\[)(\+)/i, "$1removeVolumePrice$3$4-");

    var number_list = document.getElementsByName("volume_number[]");
    var price_list  = document.getElementsByName("volume_price[]");

    number_list[number_list.length-1].value = "";
    price_list[price_list.length-1].value   = "";
  }

  /**
   * 鍒犻櫎浼樻儬浠锋牸
   */
  function removeVolumePrice(obj)
  {
    var row = rowindex(obj.parentNode.parentNode);
    var tbl = document.getElementById('tbody-volume');

    tbl.deleteRow(row);
  }

  /**
   * 鏍￠獙浼樻儬鏁版嵁鏄?惁姝ｇ‘
   */
  function checkVolumeData(isSubmit,validator)
  {
    var volumeNum = document.getElementsByName("volume_number[]");
    var volumePri = document.getElementsByName("volume_price[]");
    var numErrNum = 0;
    var priErrNum = 0;

    for (i = 0 ; i < volumePri.length ; i ++)
    {
      if ((isSubmit != 1 || volumeNum.length > 1) && numErrNum <= 0 && volumeNum.item(i).value == "")
      {
        validator.addErrorMsg(volume_num_not_null);
        numErrNum++;
      }

      if (numErrNum <= 0 && Utils.trim(volumeNum.item(i).value) != "" && ! Utils.isNumber(Utils.trim(volumeNum.item(i).value)))
      {
        validator.addErrorMsg(volume_num_not_number);
        numErrNum++;
      }

      if ((isSubmit != 1 || volumePri.length > 1) && priErrNum <= 0 && volumePri.item(i).value == "")
      {
        validator.addErrorMsg(volume_price_not_null);
        priErrNum++;
      }

      if (priErrNum <= 0 && Utils.trim(volumePri.item(i).value) != "" && ! Utils.isNumber(Utils.trim(volumePri.item(i).value)))
      {
        validator.addErrorMsg(volume_price_not_number);
        priErrNum++;
      }
    }
  }
  {/literal}
</script>
{include file="pagefooter.htm"}
